package com.hzncc.flowable_diboot.dto;

import com.diboot.core.binding.query.BindQuery;
import com.diboot.core.binding.query.Comparison;
import com.diboot.iam.entity.IamOrg;
import com.diboot.iam.entity.IamUser;
import com.hzncc.flowable_diboot.entity.ToDoList;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

        import com.hzncc.flowable_diboot.entity.Customer;
        import com.hzncc.flowable_diboot.entity.Clue;
        import com.hzncc.flowable_diboot.entity.Business;
/**
* 待办 DTO定义
*
* @author MyName
* @version 1.0
* @date 2024-06-21
 * Copyright © MyCorp
*/
@Getter
@Setter
@Accessors(chain = true)
public class ToDoListDTO extends ToDoList  {
private static final long serialVersionUID = 1285675992171292531L;

        /**
        * 开始时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime startTime;
        /**
        * 开始时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "start_time")
        private LocalDate startTimeBegin;

        /**
        * 开始时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "start_time")
        private LocalDate startTimeEnd;
        /**
        * 提醒时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime reminderTime;
        /**
        * 提醒时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "reminder_time")
        private LocalDate reminderTimeBegin;

        /**
        * 提醒时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "reminder_time")
        private LocalDate reminderTimeEnd;
        /**
        * 指派时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime disTime;
        /**
        * 指派时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "dis_time")
        private LocalDate disTimeBegin;

        /**
        * 指派时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "dis_time")
        private LocalDate disTimeEnd;
        /**
        * 下次联系时间 关联信息
        */
        @BindQuery(entity = Customer.class, column = "nextConnectTime",condition = "this.customer = id")
        private String nextContact;
        /**
        * 最后跟进时间 关联信息
        */
        @BindQuery(entity = Customer.class, column = "lastFollwUpTime",condition = "this.customer = id")
        private String lastFollow;
        /**
        * 详细地址 关联信息
        */
        @BindQuery(entity = Customer.class, column = "address",condition = "this.customer = id")
        private String address;
        /**
        * 客户级别 关联信息
        */
        @BindQuery(entity = Customer.class, column = "rank",condition = "this.customer = id")
        private String rank;
        /**
        * 线索来源 关联信息
        */
        @BindQuery(entity = Clue.class, column = "source",condition = "this.clueId = id")
        private String source;
        /**
        * 创建时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime createTime;
        /**
        * 创建时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "create_time")
        private LocalDate createTimeBegin;

        /**
        * 创建时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "create_time")
        private LocalDate createTimeEnd;
        /**
        * 更新时间
        */
        @BindQuery(comparison = Comparison.GE)
        private LocalDateTime updateTime;
        /**
        * 更新时间 起始
        */
        @BindQuery(comparison = Comparison.GE, column = "update_time")
        private LocalDate updateTimeBegin;

        /**
        * 更新时间 截止
        */
        @BindQuery(comparison = Comparison.LT, column = "update_time")
        private LocalDate updateTimeEnd;

        public LocalDate getStartTimeEnd() {
            if (getStartTime() != null) {
                return getStartTime().plusDays(1).toLocalDate();
            }
            if (startTimeEnd != null) {
                return startTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getReminderTimeEnd() {
            if (getReminderTime() != null) {
                return getReminderTime().plusDays(1).toLocalDate();
            }
            if (reminderTimeEnd != null) {
                return reminderTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getDisTimeEnd() {
            if (getDisTime() != null) {
                return getDisTime().plusDays(1).toLocalDate();
            }
            if (disTimeEnd != null) {
                return disTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getCreateTimeEnd() {
            if (getCreateTime() != null) {
                return getCreateTime().plusDays(1).toLocalDate();
            }
            if (createTimeEnd != null) {
                return createTimeEnd.plusDays(1);
            }
            return null;
        }
        public LocalDate getUpdateTimeEnd() {
            if (getUpdateTime() != null) {
                return getUpdateTime().plusDays(1).toLocalDate();
            }
            if (updateTimeEnd != null) {
                return updateTimeEnd.plusDays(1);
            }
            return null;
        }

}